package com.wpam.scrabble.mobile;

import java.io.Serializable;

public class MovePart implements Serializable, Comparable<MovePart>{
	
	private static final long serialVersionUID = 1L;
	
	private int row_;
	private int col_;
	private String letter_;
	private int points_;
	
	public MovePart(int row, int col, String letter, int points) {
		
		this.row_ = row;
		this.col_ = col;
		this.letter_ = letter;
		this.points_ = points;
	}

	public boolean touchesAccepted() {
		
		return (GameLogic.getInstance().getGameBoard().getSquare(row_ - 1, col_).isAccepted()
				|| GameLogic.getInstance().getGameBoard().getSquare(row_ + 1, col_).isAccepted()
				|| GameLogic.getInstance().getGameBoard().getSquare(row_, col_ - 1).isAccepted()
				|| GameLogic.getInstance().getGameBoard().getSquare(row_, col_ + 1).isAccepted());
	}

	public int compareTo(MovePart another) {

		if (row_ < another.row_ || (row_ == another.row_ && col_ < another.col_))
			return -1;
		if (row_ > another.row_ || (row_ == another.row_ && col_ > another.col_))
			return 1;
		return 0;
	}
	
	public int getRow() {
		return row_;
	}

	public void setRow(int row) {
		this.row_ = row;
	}

	public int getCol() {
		return col_;
	}

	public void setCol(int col) {
		this.col_ = col;
	}

	public String getLetter() {
		return letter_;
	}

	public void setLetter(String letter) {
		this.letter_ = letter;
	}

	public int getPoints() {
		return points_;
	}
}